﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace mysix
{
    public partial class Form4 : Form
    {
        string myvalue = "";
        public Form4(string myvalue)
        {
            InitializeComponent();
            this.myvalue = myvalue;
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
           
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string s1 = textBox1.Text;
            string s2 = textBox2.Text;
            string s3 = textBox3.Text;
            string s4 = textBox4.Text;
            StuDB mystu = new StuDB();

            if (myvalue == "Add")
            {
                mystu.AddStudent(int.Parse(s1), int.Parse(s2), int.Parse(s3), s4);
                dbmanager mydb = new dbmanager();
                mydb.AddLog("Student", "Add", "新增了StuId为" + s3 + "的学生");
            }
            if (myvalue == "Update")
            {
                mystu.UpdateStudent(int.Parse(s1), int.Parse(s2), int.Parse(s3), s4);
                dbmanager mydb = new dbmanager();
                mydb.AddLog("Student", "Update", "更新了StuId为" + s3 + "的学生");
            }
            this.Close();
        }
    }
}
